<template>
  <!-- 回票申请 -->
  <div class="jeecg-basic-table jeecg-basic-table-form-container">
    <a-form @keyup.enter.native="searchQuery">
      <a-row :gutter="8" type="flex">
        <a-col flex="135px">
          <a-form-item label="部门" :label-col="{ style: { width: '40px' } }" :wrapper-col="{ span: 18 }">
            <JDictSelectTag
              v-model:value="queryParam.ddlxIds"
              mode="multiple"
              dictCode="ddlxType@ddlxUser"
              placeholder="全部"
              :maxTagCount="0"
              :getPopupContainer="(node) => node.parentNode"
              :dropdownStyle="{ width: '120px', overflow: 'auto' }"
              :dropdownMatchSelectWidth="false"
            />
          </a-form-item>
        </a-col>

        <a-col flex="120px">
          <a-form-item label="方式" :label-col="{ style: { width: '50px' } }" :wrapper-col="{ span: 17 }">
            <JDictSelectTag placeholder="全部" v-model:value="queryParam.sffs" dictCode="sffsType" :dropdownMatchSelectWidth="false" :showArrow="false" :allowClear="true" />
          </a-form-item>
        </a-col>

        <a-col flex="350px">
          <a-form-item label="出团日期" :label-col="{ style: { width: '70px' } }" :wrapper-col="{ style: { width: '260px' } }">
            <a-date-picker v-model:value="queryParam.beginDate" :disabled-date="disabledStartDate" valueFormat="YYYY-MM-DD" placeholder="" style="width: 125px" /> ~
            <a-date-picker v-model:value="queryParam.endDate" :disabled-date="disabledEndDate" valueFormat="YYYY-MM-DD" placeholder="" style="width: 125px" />
          </a-form-item>
        </a-col>

        <a-col flex="145px">
          <a-form-item label="操作人" :label-col="{ style: { width: '55px' } }">
            <JDictSelectTag
              v-model:value="queryParam.userIds"
              mode="multiple"
              dictCode="sys_user,realname,id@authUser"
              placeholder="全部"
              :maxTagCount="0"
              :dropdownStyle="{ width: '120px', overflow: 'auto' }"
              :dropdownMatchSelectWidth="false"
              :allowClear="true"
            />
          </a-form-item>
        </a-col>

        <a-col flex="180px">
          <a-form-item label="订单号" :label-col="{ style: { width: '55px' } }">
            <a-input placeholder="" v-model:value="queryParam.orderId"></a-input>
          </a-form-item>
        </a-col>

        <a-col flex="auto" style="float: right; width: 90px; margin-right: 0px">
          <span style="float: right; overflow: hidden" class="table-page-search-submitButtons">
            <a-button type="primary" preIcon="ant-design:search" @click="searchQuery" class="mr-8px">查询</a-button>
            <!--a-button color="success" preIcon="ant-design:plus-outlined" @click="handleAccountPrintAdd" class="mr-8px">添加</a-button-->
            <a-button type="primary" color="warning" preIcon="ant-design:printer-outlined" @click="jsonPrint">打印</a-button>
            <!--a-badge :count="printCn" :overflowCount="9" style="position:absolute;top:-3px;right:-2px"></a-badge-->
          </span>
        </a-col>
      </a-row>

      <a-row :gutter="8" type="flex">
        <a-col flex="455px">
          <a-form-item label="采购名称" :label-col="{ style: { width: '66px' } }">
            <Cascader v-model:value="cascader.ids" :options="cascader.options" placeholder="请选择" stringToNumber @change="cooperatorSelect" :show-search="{ filter }" />
          </a-form-item>
        </a-col>

        <a-col flex="250px">
          <a-form-item label="付款单位" :label-col="{ style: { width: '65px' } }">
            <a-input placeholder="" v-model:value="queryParam.dwmc"></a-input>
          </a-form-item>
        </a-col>
      </a-row>
    </a-form>
  </div>

  <!--引用表格 :rowSelection="rowSelection"-->
  <BasicTable @register="registerTable" :loading="loading" :rowSelection="rowSelection">
    <template #no="{ record }">
      <Tag color="green">{{ render.renderDict(record.sffs, 'sffsType') }}</Tag>
    </template>
  </BasicTable>
  <!-- table区域-end v-auth="'business:delete'"-->

  <!--AccountPrintList @register="registerAccountPrintList" @success="searchQuery"></AccountPrintList-->
</template>

<script lang="ts" setup name="account-AccountFlowPrintList">
  import { ref, computed, unref, reactive, toRaw, watch, onMounted, nextTick } from 'vue';
  import { Tag } from 'ant-design-vue';
  import { BasicColumn, BasicTable } from '/@/components/Table';
  import { useModal } from '/@/components/Modal';
  import { useListPage } from '/@/hooks/system/useListPage';
  import { momentSearchQueryDate } from '/@/utils/dateUtil';
  import { render } from '/@/utils/common/renderUtils';
  import { printDataGrid, printAdd } from '/@/views/full/account/types/accountflow.api';
  import { count, print } from '/@/views/full/account/types/AccountPrint.api';
  import { useMessage } from '/@/hooks/web/useMessage';
  import { Cascader } from 'ant-design-vue';
  import { coopSelect } from '/@/views/full/business/business.api';
  import { useUserStore } from '/@/store/modules/user';
  import { printJS } from '/@/hooks/web/usePrintJS';
  import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
  import dayjs from 'dayjs';

  //初始化 -------------------------------------------------------------
  const { createMessage: $message } = useMessage();
  //定义查询表单，查询条件
  //useUserStore().getUserInfo?.id
  const queryParam = reactive<any>({
    beginDate: momentSearchQueryDate('sub'),
    endDate: momentSearchQueryDate('add'),
    stat: '1',
    sflx: '2',
    sdate: '0',
    userIds: [],
    ddlxIds: [],
    coopId: '',
  });

  //限制查询日期，开始日期不能大于结束日期
  function disabledStartDate(beginDate) {
    const endDate = queryParam.endDate;
    if (!beginDate || !endDate) {
      return false;
    }
    return beginDate.valueOf() > dayjs(endDate).valueOf();
  }

  function disabledEndDate(endDate) {
    const beginDate = queryParam.beginDate;
    if (!endDate || !beginDate) {
      return false;
    }
    return dayjs(beginDate).valueOf() > endDate.valueOf();
  }

  const sffsFmt = ({text}: { text: any }) => {
  if (!text) {
    return
  }
  let color : String[] = ['', 'red', '', 'blue', 'purple', 'orange'];
  return render.renderTag(render.renderDict(text, 'sffsType'), color[text])
}
  //初始化 -------------------------------------------------------------

  //订单列表 - 表头
  const columns: BasicColumn[] = [
    { title: '状态', align: 'center', dataIndex: 'stat', width: 40, className: 'text-red-500', customRender: ({ text }) => render.renderDict(text, 'accountStat') },
    { title: '部门', align: 'center', dataIndex: 'ddlx', width: 65, customRender: ({ text }) => render.renderDict(text, 'ddlxType') },
    { title: '订单号', align: 'center', dataIndex: 'orderId', width: 90, className: 'text-red-500' },
    { title: '付款单位', align: 'left', dataIndex: 'pathName', width: 220 },
    { title: '方式', align: 'center', dataIndex: 'sffs', width: 45, customRender: sffsFmt },
    { title: '支出', align: 'right', dataIndex: 'fkje', width: 70, className: 'text-green-500' },
    { title: '备注', align: 'left', dataIndex: 'bz', width: 250 },
    { title: '操作人', align: 'center', dataIndex: 'lrr', width: 55 },
    { title: '操作日期', align: 'center', dataIndex: 'lrsj', width: 75 },
  ];

  // 列表页面公共参数、方法
  const loading = ref<boolean>(false);
  const printCn = ref<number>(0);
  const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
    designScope: 'printDataGrid',
    tableProps: {
      rowKey: 'id',
      api: printDataGrid,
      columns: columns,
      showIndexColumn: false, //行号
      clickToRowSelect: true, //点击选择
      showActionColumn: false,
      showTableSetting: false,
      useSearchForm: false,
      showSummary: false,
      beforeFetch: (params) => Object.assign(params, unref(queryParam)),
    },
  });

  //注册table数据
  const [registerTable, { reload, setProps, getRawDataSource, setSelectedRowKeys, redoHeight }, { rowSelection, selectedRowKeys, selectedRows }] = tableContext;

  //查询 ------------
  function searchQuery() {
    setSelectedRowKeys([]);
    setProps({ searchInfo: toRaw(queryParam) });
    reload();
    getPrintCn();
  }

  function getPrintCn() {
    count().then((res) => {
      printCn.value = res;
    });
  }

  onMounted(async () => {
    await nextTick();
    let res = await getPrintCn();
  });

  /**
   * 将需要打印的业务数据，添加到打印列表表中
   * @作者 qindl
   * @日期 2023-02-17
   * @参数 record
   */
  function handleAccountPrintAdd(record) {
    //1、获取被选中的行信息
    let rows = unref(selectedRows);
    if (rows.length <= 0) {
      $message.warning('请选择'); //请勾选不能为空！
      return false;
    }

    //2、判断选中的单位是否是同一家
    var ids = '';
    for (var i = 0; i < rows.length; i++) {
      if (i == 0) {
        ids = rows[i].id;
      } else {
        ids = ids + ',' + rows[i].id;
      }
    }
    printAdd({ ids }).then((res) => {
      if (res.success == true) {
        $message.success(' 操作成功！');
        searchQuery();
      } else {
        $message.warning(res.message);
      }
    });
  }

  /**
   * 收支项目 注册弹出编辑窗口
   * @作者 qindl
   * @日期 2023-02-17
   * @参数 record
   */
  const [registerAccountPrintList, { openModal: AccountPrintListModal }] = useModal();

  //收支项目 - 打印
  function handleAccountPrintList() {
    AccountPrintListModal(true, { id: 1 });
  }

  const cascader = reactive<any>({
    ids: [],
    options: [],
  });

  function cooperatorSelect(value) {
    if (!value && value.length < 3) {
      return false;
    }
    queryParam.coopId = value[2];
  }

  const filter = (inputValue: string, path) => {
    return path.some((option) => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
  };

  //************打印*******************************************
  const date = new Date();
  let year = dayjs(date).format('YYYY');
  let month = dayjs(date).format('MM');
  let day = dayjs(date).format('DD');
  let hh = dayjs(date).format('HH');
  let mm = dayjs(date).format('mm');

  let printList = reactive<any>({}); //业务收支明细

  //点击执行
  function jsonPrint() {
    getPrintDate();
  }

  //获取数据 , 1625729754499584002, 1625729754524749825, 1625664690119708676, 1625664690119708677, 1625729754524749826, 1625729754524749827
  async function getPrintDate() {
    //1、获取被选中的行信息
    let rows = unref(selectedRows);
    if (rows.length <= 0) {
      $message.warning('请选择'); //请勾选不能为空！
      return false;
    }

    let ids = '';
    for (var i = 0; i < rows.length; i++) {
      if (i == 0) {
        ids = rows[i].id;
      } else {
        ids = ids + ',' + rows[i].id;
      }
    }
    //let record = {ids: '1625729754499584002,1625664690119708674,1625729754524749825,1625664690119708677'}

    let params = {
      ids: ids,
      createBy: queryParam.createBy,
      beginDate: queryParam.beginDate,
    };

    print(params)
      .then((res) => {
        try {
          if (res.success != true) {
            $message.warning(res.message);
            return false;
          }
          let result = res.result;
          //1、业务数据 - 初始化
          Object.assign(printList, result);
          jobPrintDate(result);
        } catch (e) {
          alert('initData : ' + e);
          return false;
        }
      })
      .finally(() => {
        //data.loading = false
      });
  }

  /**
   * @说明: 1、格式打印模版； 2、套入打印数据
   * @作者: qindl
   * @日期: 2023-03-02
   * @param data
   */
  async function jobPrintDate(data) {
    printList = data;
    if (!printList) {
      return false;
    }
    var datahtml = '',
      i = 1;
    // datahtml += '<view style="height: auto; display: block; ">';
    // datahtml += '    <span style="width: 15mm"><label>' + year + '</label>-</span>';
    // datahtml += '    <span style="width: 10mm"><label>' + month + '</label>-</span>';
    // datahtml += '    <span style="width: 10mm"><label>' + day + '</label></span> </div>';
    // datahtml += '    <span style="width: 10mm"><label>' + hh + '</label>:</span></div>';
    // datahtml += '    <span style="width: 10mm"><label>' + mm + '</label></span></div>';
    for (let k in printList) {
      datahtml += datahtml == '' ? '' : pageBreakAfter(printList[k].sffs, i);
      datahtml += '<h1 class="h1-page ' + pageTop(printList[k].sffs, i) + '">费用报销单</h1>';
      datahtml += '<div class="header">' + pageHeaderOrderId(printList[k]) + '（' + printList[k].sffsZW + '）</div>';
      datahtml += '<table border="1" cellspacing="0" class="table-page">';
      datahtml += '<tr>';
      datahtml += '  <td class="td-left" >部门</td>';
      datahtml += '  <td class="text-left" style="width: 110mm; height: 8mm; padding: 0 5px; line-height: 105%;">' + printList[k].ddlxZW + '（' + printList[k].ywlxZW + '）</td>';
      datahtml += '  <td class="td-left">填报日期</td>';
      datahtml += '  <td class="text-left" style="text-align: center">';
      datahtml += '    <span><label>' + year + '-' + month + '-' + day + ' ' + hh + ':' + mm + '</label></span>';
      datahtml += '  </td>';
      datahtml += '</tr>';
      datahtml += '<tr>';
      datahtml += '  <td class="td-left">采购单位</td>';
      datahtml += '  <td class="text-left" style="width: 110mm; height: 8mm; padding: 0 5px; line-height: 105%;">' + printList[k].dwmc + '</td>';
      datahtml += '  <td class="td-left">订单操作</td>';
      datahtml += '  <td class="text-center">' + printList[k].lrr + '</td>';
      datahtml += '</tr>';
      datahtml += '<tr>';
      datahtml += '  <td class="td-left">报销事由</td>';
      datahtml += '  <td class="text-left" colspan="3" style="height:31mm;margin:0px;padding:0 1mm;">';
      datahtml += '   <div style="line-height:110%;overflow:hidden;display:-webkit-box;text-overflow:ellipsis;-webkit-box-orient:vertical;-webkit-line-clamp:9;margin:0px;">';
      let list = printList[k].accounts || '';
      let accounts = list.optionList;
      let stat = list.stat;
      if (printList[k].sffs == '3') {
        if ( stat && stat.length > 1 ) {
          for (let p in stat) {
            datahtml += '<div style="margin:0;padding:0;margin-left:-3mm;">';
            datahtml += '  <label class="left pathname">' + stat[p].pathName + '</label>';
            datahtml += '  <label class="right" style="width: 10mm;">' + stat[p].count + '笔</label>';
            datahtml += '  <label class="right">' + stat[p].fkje + '元</label>';
            datahtml += '</div>';
          }
        } else {
          datahtml += '详见备注';
        }
      } else {
        datahtml += printList[k].bz.replace(/\n/g, '<br/>');
      }
      datahtml += '   </div>';
      datahtml += '  </td>';
      datahtml += '</tr>';
      datahtml += '<tr>';
      datahtml += '  <td colspan="4" class="text-left" style="height: 8mm; line-height: 8mm; padding: 0; ">';
      datahtml += '  <div class="left">';
      datahtml += '    <label>报销单据</label>';
      datahtml += '    <span style="padding: 5px 20px 0px 15px;"></span>';
      datahtml += '    <label style="margin-right: 30px">张</label>';
      datahtml += '    <label>合计金额（大写）</label>';
      datahtml += '    <label class="font-bold">' + numberIsMinus(printList[k], 10, '') + '</label>';
      datahtml += '    <span class="zhlangje">' + printList[k].B0 + '</span>';
      datahtml += '    <label class="font-bold">' + numberIsMinus(printList[k], 9, '佰') + '</label>';
      datahtml += '    <span class="zhlangje">' + printList[k].B1 + '</span>';
      datahtml += '    <label class="font-bold">' + numberIsMinus(printList[k], 8, '拾') + '</label>';
      datahtml += '    <span class="zhlangje">' + printList[k].B2 + '</span>';
      datahtml += '    <label class="font-bold">' + numberIsMinus(printList[k], 7, '万') + '</label>';
      datahtml += '    <span class="zhlangje">' + printList[k].B3 + '</span>';
      datahtml += '    <label class="font-bold">' + numberIsMinus(printList[k], 6, '仟') + '</label>';
      datahtml += '    <span class="zhlangje">' + printList[k].B4 + '</span>';
      datahtml += '    <label class="font-bold">' + numberIsMinus(printList[k], 5, '佰') + '</label>';
      datahtml += '    <span class="zhlangje">' + printList[k].B5 + '</span>';
      datahtml += '    <label class="font-bold">' + numberIsMinus(printList[k], 4, '拾') + '</label>';
      datahtml += '    <span class="zhlangje">' + printList[k].B6 + '</span>';
      datahtml += '    <label class="font-bold">' + numberIsMinus(printList[k], 3, '元') + '</label>';
      datahtml += '    <span class="zhlangje">' + printList[k].B7 + '</span>';
      datahtml += '    <label class="font-bold">' + numberIsMinus(printList[k], 2, '角') + '</label>';
      datahtml += '    <span class="zhlangje">' + printList[k].B8 + '</span>';
      datahtml += '    <label class="font-bold">分</label>';
      datahtml += '  </div>';
      datahtml += '  <div class="right">';
      datahtml += '    <label>￥</label>';
      datahtml += '    <span class="zhlangje" style="font-size: 16px; margin-left: -6px; margin-right: 2mm">' + printList[k].je + '元</span>';
      datahtml += '  </span>';
      datahtml += '  </td>';
      datahtml += '</tr>';
      datahtml += '</table>';
      datahtml += '<div class="footer ' + footerBottom(printList[k].sffs, i) + '" style="font-size: 12px; padding: 5px 8px">';
      datahtml += '  <div style="width: 50mm">会计主管</div>';
      datahtml += '  <div style="width: 44mm">审核</div>';
      datahtml += '  <div style="width: 44mm">出纳</div>';
      datahtml += '  <div style="width: 25mm">报销人</div>';
      datahtml += '</div>';
      datahtml += divider(printList[k].sffs, i);

      if (printList[k].sffs == '3' && list && accounts) {
        datahtml += '<h4 class="h4-page">支出明细</h4>';
        datahtml += '<table border="1" cellspacing="0" class="table-account">';
        datahtml += '<tr>';
        datahtml += '  <th style="width: 4mm;"></th>';
        datahtml += '  <th style="width: 25mm;">订单号</th>';
        datahtml += '  <th style="width: 50mm;">订单名称</th>';
        datahtml += '  <th style="width: 20mm;">支出</th>';
        datahtml += '  <th style="width: 16mm;">操作人</th>';
        datahtml += '  <th style="width: 22mm;">操作时间</th>';
        datahtml += '  <th style="width: 52mm;">备注</th>';
        datahtml += '</tr>';
        let r = 1;
        for (let o in accounts) {
          datahtml += '<tr>';
          datahtml += '  <td>' + r++ + '</td>';
          datahtml += '  <td>' + accounts[o].orderId + '</td>';
          datahtml += '  <td class="text-left">' + accounts[o].travelLine + '</td>';
          datahtml += '  <td class="text-right">' + (Math.round(accounts[o].fkje * 100) / 100).toFixed(2) + '</td>';
          datahtml += '  <td>' + accounts[o].lrr + '</td>';
          datahtml += '  <td>' + accounts[o].lrsj + '</td>';
          datahtml += '  <td class="text-left" style="line-height: 120%;">' + accounts[o].bz + '</td>';
          datahtml += '</tr>';
        }
        datahtml += '<tr>';
        datahtml += '  <td></td>';
        datahtml += '  <td>合计</td>';
        datahtml += '  <td></td>';
        datahtml += '  <td class="text-right">' + list.sumfkje + '</td>';
        datahtml += '  <td></td>';
        datahtml += '  <td></td>';
        datahtml += '  <td></td>';
        datahtml += '</tr>';
        datahtml += '</table>';
      }
      i++;
    }
    //datahtml += '</view>';

    calPrintDate(datahtml);
  }

  //打印数据
  async function calPrintDate(datahtml) {
    printJS({
      printable: [], //表格的数据
      properties: [],
      type: 'json',
      header: datahtml,
      targetStyles: ['*'],
      style: printPageStyle(),
      scanStyles: false,
    });
  }

  function printPageStyle() {
    let style = `
    @page{ size: auto A4 landscape; margin: 8mm; }
    .h1-page{
      font-weight: 600;
      margin: 0 auto;
      text-align: center;
      font-size: 22px;
      letter-spacing: 15px;
    }
    .h1-top1 { margin-top: 1mm; }
    .h1-top2 { margin-top: 10mm; }
    .header {
      width: 190mm;
      margin: 0 auto;
      margin-top: 0mm;
      margin-bottom: 1mm;
      font-size: 12px;
    }
    .header .span-page{
      width:80mm;
      font-size: 12px;
    }
    .header .span-page span{
      display: inline-block;
      height: 18px;
      line-height: 18px;
    }
    .header .span-page span label{
      font-size: 16px;
      font-weight: 500;
      padding: 0 2px;
      height: 14px;
      line-height: 16px;
    }
    .left {
      text-align:left;
      float:left;
      margin-left:12px;
    }
    .right {
      text-align:right;
      float:right;
    }
    table, table tr th, table tr td { border: 1px solid #808080; }
    table { border-collapse: collapse; font-size: 12px; width: 190mm; margin: 0 auto; text-align:center; }
    .table-page .text-left, .table-account .text-left { text-align:left; }
    .table-page .text-right, .table-account .text-right { text-align:right; }
    .table-page td { padding: 5px 10px; }
    .table-page td span{
      padding: 5px 1px 0px 0px;
      font-size: 14px;
    }
    .table-page td label{
      padding: 5px 0px 1px 0px;
      font-size: 12px;
    }
    .table-page td .fr { float: right }
    .td-left {
      width: 13mm;
      text-align-last: justify;
    }
    .font-bold {
      font-weight: bold
    }
    .h4-page{ width: 190mm; margin: 0 auto; margin-bottom: 3px; margin-top: 20px; }
    .table-account th, .table-account td { padding: 2px 5px; }
    .footer{
      width: 190mm;
      height: 25px;
      margin: 0 auto;
    }
    .footer-bottom1 { margin-bottom: 0mm; }
    .footer-bottom2 { margin-bottom: 10mm; }
    .footer div {
      display: inline-block;
      float: left;
    }
    hr.dashed {
      width: 190mm;
      border: 0;
      border-bottom: 1px dashed #ccc;
      background: #999;
      margin: 0 auto;
    }
    .pathname {
      width: 140mm;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  `;
    return style;
  }

  /**
   *
   * @param sffs
   * @param idx
   */
  function pageBreakAfter(sffs, idx) {
    if (sffs == '3' || (idx - 1) % 3 == 0) {
      return '<div style="page-break-after: always; "></div>';
    } else {
      return '';
    }
  }

  /**
   *
   * @param sffs
   * @param idx
   */
  function pageTop(sffs, idx) {
    if (sffs == '3' || (idx - 1) % 3 == 0) {
      return 'h1-top1';
    } else {
      return 'h1-top2';
    }
  }

  /**
   * 转账的第三笔数据，在纸张的底部时，下边距应为0。
   * @param sffs
   * @param idx
   */
  function footerBottom(sffs, idx) {
    if (sffs != '3' && idx % 3 == 0) {
      return 'footer-bottom1';
    } else {
      return 'footer-bottom2';
    }
  }

  //分割线
  function divider(sffs, idx) {
    if (sffs == '3' || idx % 3 != 0) {
      return '<hr class="dashed"></hr>';
    } else {
      return '';
    }
  }

  function pageHeaderOrderId(p) {
    let sffs = p.sffs;
    let list = p.accounts || '';
    let accounts = list.optionList || [];
    let l = accounts.length;
    let orderId = p.orderId;
    //console.info("p.orderId2", (l - 1) , p.orderId, list)
    if (sffs == '3' && list && accounts && l > 1) {
      let o1 = accounts[0].orderId;
      let o2 = accounts[l - 1].orderId;
      if (o1 != o2) {
        orderId = o1 + ' ~ ' + o2;
      }
    }
    return orderId;
  }

  /**
   * 是否是负数，是则将分位符换成负字，不是则输入
   * @param print 数据 
   * @param pos   当前位置 
   */
  function numberIsMinus(pnt, pos, val) {
    if (pnt.isFs == true && pnt.len == pos) {
      val = '负';
    }
    return val;
  }

  onMounted(async () => {
    await nextTick();
    let res = await coopSelect();
    Object.assign(cascader.options, res);
  });

</script>
<style lang="less" scoped></style>
